<?php

namespace Home\Controller;

use Think\Controller;

class CustomFeedbackController extends Controller {

    public function index() {
        $this->display("CustomFeedback");
    }

    public function getCustomFeedbackList(){
        $feedbackObj=M('customfeedback');
        $condition["PublicCodeID"] = 1;
        $feedbackArray = $feedbackObj->where($condition)->order('ID desc')->select();
        if (count($feedbackArray) == 0) {
            $feedbackArray = array();
        } else {
            for ($index = 0; $index < count($feedbackArray); $index++) {
                $feedbackArray[$index]['InsertTime'] = date('Y-m-d H:i:s', $feedbackArray[$index]['InsertTime']);
            }
        }
        
         if (count($feedbackArray)) {
            $json = json_encode($feedbackArray, JSON_UNESCAPED_UNICODE);
            $this->ajaxReturn($json, 'EVAL');
        } else {
            $this->ajaxReturn('[]', 'EVAL');
        }
    }
}
